/*
 * @Author: cl
 * @Description: 成绩
 * @Date: 2023-04-18 11:13:18
 * @LastEditTime: 2023-05-08 16:52:24
 * @FilePath: \jsnode\nestjs\naota\src\score\score.controller.ts
 * @LastEditors: cl
 */
import { Body, Controller, Delete, Get, Param, Patch, Post, Query } from '@nestjs/common'
import { ApiTags } from '@nestjs/swagger'
import { CreateScoreDto } from './dto/create-score.dto'
import { UpdateScoreDto } from './dto/update-score.dto'
import { ScoreService } from './score.service'

@Controller('score')
@ApiTags('成绩')
export class ScoreController {
  constructor(private readonly scoreService: ScoreService) {}

  @Post('add')
  create(@Body() createScoreDto: CreateScoreDto) {
    return this.scoreService.create(createScoreDto)
  }

  @Get('findAll')
  findAll(@Query('stuId') stuId:number) {
    return this.scoreService.findAll(stuId)
  }

  @Get(':id')
  findOne(@Param('id') id: string) {
    return this.scoreService.findOne(+id)
  }

  @Patch(':id')
  update(@Param('id') id: string, @Body() updateScoreDto: UpdateScoreDto) {
    return this.scoreService.update(+id, updateScoreDto)
  }

  @Delete(':id')
  remove(@Param('id') id: string) {
    return this.scoreService.remove(+id)
  }
}
